package com.atguigu.atcrowdfunding.potal.service.impl;

import com.atguigu.atcrowdfunding.bean.Member;
import com.atguigu.atcrowdfunding.potal.dao.MemberMapper;
import com.atguigu.atcrowdfunding.potal.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author xzt
 * @create 2021-03-12 15:58
 */
@Service
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberMapper memberMapper;

    @Override
    public Member queryMemberLogin(HashMap<String, Object> paramMap) {
        Member member = memberMapper.queryMebmerlogin(paramMap);

        if(member == null){
            throw new RuntimeException("用户名或密码错误");
        }

        return member;
    }

    @Override
    public void updateAcctType(Member member) {
        memberMapper.updateAcctType(member);
    }

    @Override
    public void updateBasicinfo(Member member) {
        memberMapper.updateBasicinfo(member);
    }

    @Override
    public void updateEmail(Member loginMember) {
        memberMapper.updateEmail(loginMember);
    }

    @Override
    public void updateAuthstatus(Member loginMember) {
        memberMapper.updateAuthstatus(loginMember);
    }

    @Override
    public Member getMemberById(Integer memberid) {
        return memberMapper.getMemberById(memberid);
    }

    @Override
    public List<Map<String, Object>> queryCertByMemberid(Integer memberid) {
        return memberMapper.queryCertByMemberid(memberid);
    }

    @Override
    public void deleteImg(Member member) {
        memberMapper.deleteImg(member);
    }
}
